Skip to content

fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571

Open
JessicaMulein wants to merge 1 commit into
cecli-dev:mainfrom
Digital-Defiance:pr/fix-reflected-message-init
Open

fix(coders): initialize reflected_message in __init__ to prevent AttributeError#571
JessicaMulein wants to merge 1 commit into
cecli-dev:mainfrom
Digital-Defiance:pr/fix-reflected-message-init

Conversation

@JessicaMulein

Copy link
Copy Markdown

Summary

reflected_message was only initialized in init_before_message(), called from the normal run() loop. Code paths that bypass run() — such as run_one_shot() or run_message() — could trigger check_for_file_mentions() before init_before_message() was called, raising:

AttributeError: 'EditBlockCoder' object has no attribute 'reflected_message'

This occurred when a local model emitted a [ContextManager] file reference during a headless session (spec generation), causing check_for_file_mentions to access self.reflected_message at line 2541 of base_coder.py.

Fix

Initialize self.reflected_message = None in Coder.__init__() so the attribute always exists regardless of entry point.

Test plan

  • All existing pytest pass (no behavioral change — init_before_message still resets to None on every normal run())
  • Reproducer: spec-gen explore turn with qwen3.6:35b emitting [ContextManager] no longer crashes

…ibuteError

The reflected_message attribute was only initialized in init_before_message(),
which is called from the normal run() loop. Code paths that bypass run() — such
as run_one_shot() used by spec generation, or run_message() used by headless
agent sessions — could trigger check_for_file_mentions() before
init_before_message() was ever called, raising:

    AttributeError: 'EditBlockCoder' object has no attribute 'reflected_message'

This occurred in production when a local model (qwen3.6:35b) emitted a
[ContextManager] file reference during a spec-gen explore turn, causing
check_for_file_mentions to access self.reflected_message on line 2541.

Fix: set self.reflected_message = None in Coder.__init__() so the attribute
always exists regardless of entry point.
JessicaMulein added a commit to Digital-Defiance/BrightVision that referenced this pull request Jun 12, 2026
…ror in spec-gen

Cherry-pick of cecli-dev/cecli#571: initialize reflected_message in
Coder.__init__() so headless paths (run_one_shot, run_message) don't crash
when check_for_file_mentions accesses the attribute before init_before_message.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant